﻿/** 
 * Copyright / Licence
 * <p>
 * You are free:
 * <li>to Share — to copy, distribute and transmit the work
 * <li>to Remix — to adapt the work
 * </p>
 * <p>
 * Under the following conditions:
 * <li>Attribution — You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).
 * <li>Noncommercial — You may not use this work for commercial purposes.
 * <li>Share Alike — If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.
 * </p>
 * <p>
 * More information can be found here:
 * <br/>
 * http://creativecommons.org/licenses/by-nc-sa/3.0/
 * </p>
 * <p>
 * Please contact Manfred Weber [manfred.weber@gmail.com] if you require a commercial licence
 * </p>
 */
 package org.dschini.ui.maps.world {

	import flash.events.*;
	import flash.display.*;
	import org.dschini.data.ui.maps.*;
	import org.dschini.data.ui.maps.world.*;
	import org.dschini.data.ui.maps.world.africa.*;
	import org.dschini.ui.maps.*;
	import org.dschini.ui.maps.world.*;
	import org.dschini.ui.maps.world.africa.*;

	public class AfricaMap extends Map
	{
		public var africaMapCountryLines:MovieClip;

		public var mascareneIslandsMap:MascareneIslandsMap;
		public var madagascarMap:MadagascarMap;
		public var comoroIslandsMap:ComoroIslandsMap;
		public var southAfricaMap:SouthAfricaMap;
		public var lesothoMap:LesothoMap;
		public var swazilandMap:SwazilandMap;
		public var namibiaMap:NamibiaMap;
		public var botswanaMap:BotswanaMap;
		public var zimbabweMap:ZimbabweMap;
		public var mozambiqueMap:MozambiqueMap;
		public var angolaMap:AngolaMap;
		public var zambiaMap:ZambiaMap;
		public var malawiMap:MalawiMap;
		public var tanzaniaMap:TanzaniaMap;
		public var congoMap:CongoMap;
		public var cabindaMap:CabindaMap;
		public var congoBrazzavilleMap:CongoBrazzavilleMap;
		public var gabonMap:GabonMap;
		public var equatorialGuineaMap:EquatorialGuineaMap;
		public var burundiMap:BurundiMap;
		public var rwandaMap:RwandaMap;
		public var ugandaMap:UgandaMap;
		public var kenyaMap:KenyaMap;
		public var somaliaMap:SomaliaMap;
		public var ethiopiaMap:EthiopiaMap;
		public var djiboutiMap:DjiboutiMap;
		public var eritreaMap:EritreaMap;
		public var cameroonMap:CameroonMap;
		public var centralAfricanRepublicMap:CentralAfricanRepublicMap;
		public var sudanMap:SudanMap;
		public var chadMap:ChadMap;
		public var egyptMap:EgyptMap;
		public var libyaMap:LibyaMap;
		public var nigeriaMap:NigeriaMap;
		public var nigerMap:NigerMap;
		public var tunisiaMap:TunisiaMap;
		public var algeriaMap:AlgeriaMap;
		public var moroccoMap:MoroccoMap;
		public var westernSaharaMap:WesternSaharaMap;
		public var mauritaniaMap:MauritaniaMap;
		public var maliMap:MaliMap;
		public var burkinaFasoMap:BurkinaFasoMap;
		public var beninMap:BeninMap;
		public var togoMap:TogoMap;
		public var ghanaMap:GhanaMap;
		public var coteDIvoireMap:CoteDIvoireMap;
		public var liberiaMap:LiberiaMap;
		public var sierraLeoneMap:SierraLeoneMap;
		public var guineaMap:GuineaMap;
		public var guineaBissauMap:GuineaBissauMap;
		public var senegalMap:SenegalMap;
		public var gambiaMap:GambiaMap;
		public var madeiraMap:MadeiraMap;
		public var canaryIslandsMap:CanaryIslandsMap;

		public function AfricaMap():void
		{
			countries = [
					mascareneIslandsMap,
					madagascarMap,
					comoroIslandsMap,
					southAfricaMap,
					lesothoMap,
					swazilandMap,
					namibiaMap,
					botswanaMap,
					zimbabweMap,
					mozambiqueMap,
					angolaMap,
					zambiaMap,
					malawiMap,
					tanzaniaMap,
					congoMap,
					cabindaMap,
					congoBrazzavilleMap,
					gabonMap,
					equatorialGuineaMap,
					burundiMap,
					rwandaMap,
					ugandaMap,
					kenyaMap,
					somaliaMap,
					ethiopiaMap,
					djiboutiMap,
					eritreaMap,
					cameroonMap,
					centralAfricanRepublicMap,
					sudanMap,
					chadMap,
					egyptMap,
					libyaMap,
					nigeriaMap,
					nigerMap,
					tunisiaMap,
					algeriaMap,
					moroccoMap,
					westernSaharaMap,
					mauritaniaMap,
					maliMap,
					burkinaFasoMap,
					beninMap,
					togoMap,
					ghanaMap,
					coteDIvoireMap,
					liberiaMap,
					sierraLeoneMap,
					guineaMap,
					guineaBissauMap,
					senegalMap,
					gambiaMap,
					madeiraMap,
					canaryIslandsMap
			]
		}
		
		override public function set mouseEnabled( mouseEnabled:Boolean ):void
		{
			super.mouseEnabled = mouseEnabled;
			for(var i:int=0; i<countries.length; i++){
				Map(countries[i]).mouseEnabled = mouseEnabled;
			}
		}
		
		override public function set doubleClickEnabled( doubleClickEnabled:Boolean ):void
		{
			super.doubleClickEnabled = doubleClickEnabled;
			for(var i:int=0; i<countries.length; i++){
				Map(countries[i]).doubleClickEnabled = doubleClickEnabled;
			}
		}
		
		override public function set data( data:MapData ):void
		{
			_data = data;
			for(var i:int=0; i<countries.length; i++){
				countries[i].data = MapData(_data).countries[i];
			}
		}
		
		override public function render():void
		{
			africaMapCountryLines.visible = data.countryLinesVisible ? true : false;
			if( data.countryLinesColorTransform ){
				africaMapCountryLines.transform.colorTransform = data.countryLinesColorTransform;
			}
			for(var i:int=0; i<countries.length; i++){
				countries[i].render();
			}
		}
	}
}
